<template>
     <div class="detail-content">
        <Form
            :page="page"
            @saveMore="saveMore"
            @cancelSubmit="cancelSubmit"
            @saveData="submitData"
            :formProps="formProps"
            :saveBtn="'保存并继续添加'" />
     </div>
</template>

<script setup>
import { computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useDetailData } from './useDetailData';

const router = useRouter();
const page = computed(() => router.currentRoute.value.query?.page);
const {
  formProps, submitData, getEmployeeDetail, saveMore,
} = useDetailData(page);
onMounted(() => {
  if (page.value === 'edit') {
    getEmployeeDetail(router.currentRoute.value.query?.id);
  }
});
function cancelSubmit() {
  router.go(-1);
}
</script>
<style scoped lang="css">
.detail-content {
  padding: 30px;
  background-color: var(--el-bg-color);
}
</style>
